package tt.dz.appserver.util;

import javax.servlet.http.HttpServletRequest;

/**
 * request相关帮助
 * @author xielf
 *
 */
public class RequestUtils {

	
	/**
	 * 获取项目的根访问路径
	 * @param request
	 * @return
	 */
	public static final String getProjectBasePath(HttpServletRequest request){
		
		String path = request.getContextPath();
		String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
		return basePath;
	}
	
	/**
	 * 得到项目根文件路径
	 * @param request
	 * @return
	 */
	public static final String getProjectRootPath(HttpServletRequest request){
		
		return request.getSession().getServletContext().getRealPath("/");
	}
	
}
